package com.bhs.sansonglogistics.ui.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.bean.CityBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class CityAdapter extends BaseQuickAdapter<CityBean, BaseViewHolder> {

    private int type;
    private boolean isMultipleChoice;

    public CityAdapter(@Nullable List<CityBean> data, int type,boolean isMultipleChoice) {
        super(R.layout.item_city, data);
        this.type = type;
        this.isMultipleChoice = isMultipleChoice;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, CityBean item) {
        helper.setText(R.id.tv_city, item.getCity_name());
        helper.setTextColor(R.id.tv_city, item.isCheck() ? mContext.getColor(R.color.main) : mContext.getColor(R.color.black));
        helper.setGone(R.id.iv_check, type == 3 && item.isCheck() && isMultipleChoice);
    }
}
